import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

public class Test {
    public static void main(String[] args) {
        List<Student> students = new ArrayList<Student>();
        students.add(new Student(1,90.0));
        students.add(new Student(2,90.0));
        students.add(new Student(3,91.0));
        students.add(new Student(4,92.0));
        students.sort(
                new Comparator<Student>() {

                    @Override
                    public int compare(Student o1, Student o2) {
                        if(Math.abs(o1.score - o2.score) < 1e-9){
                            return o1.id - o2.id;
                        }
                        return Double.compare(o2.score, o1.score);
                    }
                }
        );
        for(Student st : students){
            // 保留两位小数
            System.out.printf("%d %.2f\n", st.id, st.score);
        }
    }
    public static class Student{
        int id;
        Double score;
        public Student(int id, Double score) {
            this.id = id;
            this.score = score;
        }
    }
}
